local CommonOHOH = _G.CommonOHOH

local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseComponent());

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
    self.Animatior=self.parent:AddComponent(_G.CommonOHOH.load.CharacterAnimationCtrl()); 

    local  animationList={
        _G.ClientOHOH:GetPath_Loop("Touch.hunger",self.parent:GetRoot()):Clone(),
        _G.ClientOHOH:GetPath_Loop("Touch.wake",self.parent:GetRoot()):Clone(),
        _G.ClientOHOH:GetPath_Loop("Touch.feed",self.parent:GetRoot()):Clone(),

    }
    
    -- self.Animatior:PreLoadAnimationObject(animationList,function()
    --     print("-------等待觉醒好友 加载成功---")

    -- end,nil,{["hunger"]=false,["wake"]=false,["feed"]=false})


        
    self.Animatior:PreLoadAnimationObject(animationList,function()
        -- print("-------等待觉醒好友 加载成功---")
    end,nil,{["hunger"]=true,["wake"]=false,["feed"]=false})


    self.Animatior:PlayAnimation("hunger")

    self.parent.AwakeEvent:Connect(function()



        self.Animatior:StopAll()
            local t= self.Animatior:PlayAnimation("wake")
            delay(t,function()
                self.parent:dtor()
            end)
    end)


    self.parent.FeedEvent:Connect(function()

        self.Animatior:StopAll()
        local t= self.Animatior:PlayAnimation("feed")
        delay(t,function()
            self.parent.AwakeEvent:Action()
        end)       
    end)


end;

function M.dtor(self)
	M.super.dtor(self);
end

function M.Hide(self)
    self.ui.Enabled=false
end

function M.Show(self)
    self.ui.Enabled=true
end

function M.Update(self)

end
return M

